package com.zhonghui.common.eshopEnum;

import java.util.stream.Stream;

public enum  ProductEnum {
    TYPE_1(1, "精品推荐"),
    TYPE_2(2, "热门榜单"),
    TYPE_3(3, "首发新品"),
    TYPE_4(4, "猜你喜欢");

    private Integer value;
    private String desc;

    public static ProductEnum toType(int value) {
        return (ProductEnum) Stream.of(values()).filter((p) -> {
            return p.value == value;
        }).findAny().orElse( (ProductEnum) null );
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }

    private ProductEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
}
